project(AlgoCommon CXX)

file(GLOB_RECURSE SOURCES "src/*.cpp" "src/*.c" "src/*.h" "include/*.h" "include/*.hpp" "${CMAKE_SOURCE_DIR}/include/*.h")
set(MODULE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(PROJECT_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)

add_library(${PROJECT_NAME} ${ALGORITHM_LIBRARY_TYPE} ${SOURCES})
assign_source_group(${SOURCES})

target_include_directories(${PROJECT_NAME} PUBLIC
    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
    $<BUILD_INTERFACE:${MODULE_INCLUDE_DIR}>
    $<BUILD_INTERFACE:${PROJECT_INCLUDE_DIR}>
    $<INSTALL_INTERFACE:${PROJECT_INCLUDE_DIR}>
    $<INSTALL_INTERFACE:include>
)

if(BUILD_SHARED)
    target_compile_definitions(${PROJECT_NAME} PRIVATE ALGOHUB_BUILD)
endif()

target_compile_definitions(${PROJECT_NAME} PRIVATE ALGORITHMS_INTERNAL_DEBUG_MODE)
set(ALL_ALGORITHM_TARGETS ${ALL_ALGORITHM_TARGETS} ${PROJECT_NAME} PARENT_SCOPE)

copy_third_party_dlls_to_output(${PROJECT_NAME})
install_as_third_party(${PROJECT_NAME})
